<template>
  <div class="Navigation">
    <div class="navPersonage"></div>
    <!-- 鼠标移入头像个人菜单 -->
    <div
      class="Menu_list"
      @mouseenter="overBar()"
      @mouseleave="enterBar()"
      v-if="inOut == 1"
    >
      <Menulist></Menulist>
    </div>
    <!-- 位置切换 -->
    <div class="Nav_position">
      <i class="el-icon-location-outline"></i>
      <p>北京</p>
      <p class="p_cut">[切换]</p>
    </div>
    <!-- 导航菜单 -->
    <div class="Nav_menu">
      <menuBox :navNum="navNum"></menuBox>
    </div>
    <!-- 个人消息.. -->
    <div class="Nav_avatar">
      <i class="el-icon-message"></i>
      <i class="el-icon-chat-square"></i>
      <i class="el-icon-sort"></i>
      <p>个人</p>
    </div>
    <!-- 个人头像 -->
    <div class="Nav_avatar_one" @mouseenter="over()" @mouseleave="enter()">
      <div class="avatar_img"></div>
      <div class="name_id">
        <div class="name_id_box">张 三</div>
        <div class="name_id_box">ID:6666666666</div>
      </div>
    </div>
  </div>
</template>

<script>
// 引入 导航菜单 组件
import menuBox from "./menuBox.vue";
// 鼠标在头像部分 出现菜单点击跳转页面  组件
import Menulist from "../views/home/components/Popup/Menulist.vue";
export default {
  // 组件名称
  name: "Login",
  // 组件参数 接收来自父组件的数据
  props: {
    navNum:{}
  },
  // 局部注册的组件
  components: {menuBox, Menulist,},
  // 组件状态值
  data() {
    return {
      input: "",
      inOut: "2", // 鼠标移入移出顶部头像显示隐藏菜单
      num: "", // 判断鼠标是否移入个人中心菜单栏
      num1: "", // 判断鼠标是否移入个人中心菜单栏
      timeId: "", // 延时器
    };
  },
  // 组件初始化
  created() {},
  // 组件实例挂载完毕
  mounted() {},
  //销毁事件
  destroyed() {},
  // 组件方法
  methods: {
    // 鼠标移入事件
    over() {
      this.inOut = "1";
      clearTimeout(this.timeId);
    },
    // 鼠标移出事件
    enter() {
      var that = this;
      this.timeId = setTimeout(function () {
        console.log(1111);
        that.inOut = "2";
      }, 300);
    },
    // 移入个人菜单栏
    overBar() {
      clearTimeout(this.timeId);
      this.inOut = "1";
    },
    enterBar() {
      this.inOut = "2";
    },
  },
};
</script>

<style scoped lang="less">
// 头像鼠标移入菜单
.Menu_list {
  width: 200px;
  height: 340px;
  border: 1px solid gray;
  background-color: #ffffff;
  position: absolute;
  right: 10px;
  top: 65px;
  border-radius: 10px;
  z-index: 100;
}
// body
.Navigation {
  min-width: 1230px;
  height: 100%;
  color: #ffffff;
  margin: 0 auto;
  display: flex;
  position: relative;
  // 城市切换
  .Nav_position {
    width: 10%;
    height: 20px;
    display: flex;
    margin: auto;
    line-height: 20px;
    font-size: 16px;
    // border: 1px solid gold;
    .el-icon-location-outline {
      font-size: 20px;
      // margin-top: 3px;
    }
    p {
      // height: 32px;
      // line-height: 32px;
      margin-left: 5px;
      // font-size: 17px;
      // border: 1px solid gold;
    }
    .p_cut {
      text-decoration: underline;
      font-weight: 500;
      margin-left: 3px;
      // margin-top: 1px;
    }
  }
  // 导航菜单
  .Nav_menu {
    width: 50%;
    height: 22px;
    // border: 1px solid gold;
    margin: auto;
  }

  // 个人 消息
  .Nav_avatar {
    width: 13%;
    height: 20px;
    margin: auto;
    display: flex;
    // border: 1px solid gold;
    .el-icon-message {
      font-size: 20px;
      // margin-top: 2px;
    }
    .el-icon-chat-square {
      font-size: 20px;
      // margin-top: 2px;
      margin-left: 20px;
    }
    .el-icon-sort {
      -webkit-transform: rotate(90deg);
      font-size: 20px;
      margin-left: 20px;
    }
    p {
      font-size: 16px;
      // line-height: 30px;
      margin-left: 10px;
    }
  }
  // 个人头像id
  .Nav_avatar_one {
    width: 17%;
    height: 36px;
    margin: auto;
    display: flex;
    // border: 1px solid gold;
    .avatar_img {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      margin-left: 15px;
      border: 1px solid gray;
      background-image: url("./../assets/imgs/avatarimg.jpg");
      background-size: 100% 100%;
    }
    .name_id {
      height: 40px;
      margin: auto ;
      margin-top: 2px;
      margin-left: 5px;
      .name_id_box {
        height: 18px;
        line-height: 18px;
        font-size: 15px;
        font-weight: 500;
      }
    }
  }
}
</style>
